package com.oasystem.domain.user;

import com.oasystem.enums.EPermissionType;

public class Permission {
	private String permissionID;
	private String userId;
	private String code;

	public Permission() {
	}

	public Permission(String code) {
		this.code = code;
	}

	public boolean isNormalUser() {
		return EPermissionType.NORMAL == EPermissionType.getByCode(code);
	}

	public boolean isLeader() {
		return EPermissionType.LEADER == EPermissionType.getByCode(code);
	}

	public boolean isAdmin() {
		return EPermissionType.SYSTEM == EPermissionType.getByCode(code);
	}

	public boolean isAccounting() {
		return EPermissionType.ACCOUNTING == EPermissionType.getByCode(code);
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return EPermissionType.getByCode(code).getDescription();
	}

	public String getPermissionID() {
		return permissionID;
	}

	public void setPermissionID(String permissionID) {
		this.permissionID = permissionID;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

}
